package com.kfm.servlet.day02;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/scope")
public class ReqServlet1 extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException {
        //获取数据
        String name1 = (String) request.getAttribute("name");
        System.out.println(name1);
        //存入数据
        request.setAttribute("name", "张三");
        //移除数据
//        request.removeAttribute("name");
//        String name2 = (String) request.getAttribute("name");
//        System.out.println(name2);
    }
}
